<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	
	<title>{$pageTitle}</title>
	
	<!-- head --><meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	{include file="head.tpl"}
	
</head>

<body>

<!-- body_js -->
{include file="body_js.tpl"}

	<div id="wrap">
		
		<!-- header -->
		{include file="header.tpl"}
		
		<div id="body">
			
			<div id="body_left">
			
				<!-- breadcrumbs -->
				{include file="breadcrumbs.tpl"}
			
				<h1> {l s='Editar poesía'} </h1>
					
				{if $error_msg ne ""}
					<div class="error" id="notice">
						{$error_msg}
					</div>
				{/if}
				
				{if $form_sent eq "yes" and $error_msg eq ""}
					<div class="notice" id="notice">
						<p> {l s='Tu poesía ha sido publicada!'} </p>
					</div>
					<p>
						<input type="button" value="Continua" onclick="javascript:window.location='{$smarty.const.BASE_URL}poem.php?id={$poemId}'" />
					</p>
				{else}
					<form action="{$smarty.const.BASE_URL}edit-poem.php?id={$poemId}" method="post">

                                        <p class="form_item">
					<span class="label">{l s='Idioma'}</span>
					<span class="desc">{l s='En que idioma está escrita?'}</span>
					<select name="lang" id="lang_poem_combo">
						{foreach from=$languages key=code item=name}
                                                  <option value="{$code}"{if $code eq $smarty.post.lang} selected="selected"{/if}>{$name}</option>
						{/foreach}
					</select>
					</p>

					<p class="form_item">
					<span class="label">{l s='TÍTULO'}</span>
					<span class="desc">{l s='Cómo se llama la poesía?'}</span>
					<input name="form_sent" type="hidden" value="yes" />
					<input name="title" id="title" value="{$title}" class="verywide" />
					</p>
					
					<p class="form_item">
					<span class="label">{l s='CATEGORÍA'}</span>
					<span class="desc">{l s='A qué categoría corresponde?'}</span>
					<select name="category" id="category">
						<option value="">-- alege o categorie --</option>
						{section name=category loop=$categories}
							<option value="{$categories[category].id}"{if $categories[category].selected} selected="selected"{/if}>{$categories[category].name}</option>
						{/section}
					</select>
					</p>
					
					{if $session_admin == 1}
					<p class="form_item">
					<span class="label">AUTOR</span>
					<span class="desc">{l s='Por quiés está escrita?'}</span>
					<select name="author" style="width:150px;">
						{section name=author loop=$authors}
							<option value="{$authors[author].username}" {if $smarty.post.author eq $authors[author].username} selected="selected"{/if}>{$authors[author].username} ({$authors[author].fullname})</option>
						{/section}
					</select>
					</p>
					{/if}
					
					<p class="form_item">
					<span class="label">{l s='POESÍA'}</span>
					<textarea name="poem" id="poem" rows="30" cols="55">{$poem}</textarea>
					</p>

					<p class="form_item">
					<input type="submit" value="{l s='Editar poesía'}" /> <input type="button" value="{l s='Cancelar'}" onclick="javascript:window.location='{$smarty.const.BASE_URL}poem.php?id={$poemId}';" />
					</p>
					
					</form>
				{/if}
				
			</div>
			<div id="body_right">
			  <!-- body_right -->
				{include file="body_right.tpl"}
			</div>
			<div class="clearer"></div>
		</div>
	</div>
	<!-- footer -->
	{include file="footer.tpl"}
</body>
</html>
